/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Wires.impl;

import EA_Model.IEC61970.Core.impl.EquipmentImpl;

import EA_Model.IEC61970.Domain.PerCent;
import EA_Model.IEC61970.Domain.Voltage;

import EA_Model.IEC61970.Wires.PowerTransformer;
import EA_Model.IEC61970.Wires.WiresPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Power Transformer</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.PowerTransformerImpl#getBmagSat <em>Bmag Sat</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.PowerTransformerImpl#getMagBaseU <em>Mag Base U</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Wires.impl.PowerTransformerImpl#getMagSatFlux <em>Mag Sat Flux</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PowerTransformerImpl extends EquipmentImpl implements PowerTransformer {
	/**
	 * The cached value of the '{@link #getBmagSat() <em>Bmag Sat</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBmagSat()
	 * @generated
	 * @ordered
	 */
	protected PerCent bmagSat;

	/**
	 * The cached value of the '{@link #getMagBaseU() <em>Mag Base U</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMagBaseU()
	 * @generated
	 * @ordered
	 */
	protected Voltage magBaseU;

	/**
	 * The cached value of the '{@link #getMagSatFlux() <em>Mag Sat Flux</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMagSatFlux()
	 * @generated
	 * @ordered
	 */
	protected PerCent magSatFlux;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PowerTransformerImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return WiresPackage.Literals.POWER_TRANSFORMER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent getBmagSat() {
		if (bmagSat != null && bmagSat.eIsProxy()) {
			InternalEObject oldBmagSat = (InternalEObject)bmagSat;
			bmagSat = (PerCent)eResolveProxy(oldBmagSat);
			if (bmagSat != oldBmagSat) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.POWER_TRANSFORMER__BMAG_SAT, oldBmagSat, bmagSat));
			}
		}
		return bmagSat;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent basicGetBmagSat() {
		return bmagSat;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBmagSat(PerCent newBmagSat) {
		PerCent oldBmagSat = bmagSat;
		bmagSat = newBmagSat;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.POWER_TRANSFORMER__BMAG_SAT, oldBmagSat, bmagSat));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getMagBaseU() {
		if (magBaseU != null && magBaseU.eIsProxy()) {
			InternalEObject oldMagBaseU = (InternalEObject)magBaseU;
			magBaseU = (Voltage)eResolveProxy(oldMagBaseU);
			if (magBaseU != oldMagBaseU) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.POWER_TRANSFORMER__MAG_BASE_U, oldMagBaseU, magBaseU));
			}
		}
		return magBaseU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetMagBaseU() {
		return magBaseU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMagBaseU(Voltage newMagBaseU) {
		Voltage oldMagBaseU = magBaseU;
		magBaseU = newMagBaseU;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.POWER_TRANSFORMER__MAG_BASE_U, oldMagBaseU, magBaseU));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent getMagSatFlux() {
		if (magSatFlux != null && magSatFlux.eIsProxy()) {
			InternalEObject oldMagSatFlux = (InternalEObject)magSatFlux;
			magSatFlux = (PerCent)eResolveProxy(oldMagSatFlux);
			if (magSatFlux != oldMagSatFlux) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX, oldMagSatFlux, magSatFlux));
			}
		}
		return magSatFlux;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PerCent basicGetMagSatFlux() {
		return magSatFlux;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMagSatFlux(PerCent newMagSatFlux) {
		PerCent oldMagSatFlux = magSatFlux;
		magSatFlux = newMagSatFlux;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX, oldMagSatFlux, magSatFlux));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case WiresPackage.POWER_TRANSFORMER__BMAG_SAT:
				if (resolve) return getBmagSat();
				return basicGetBmagSat();
			case WiresPackage.POWER_TRANSFORMER__MAG_BASE_U:
				if (resolve) return getMagBaseU();
				return basicGetMagBaseU();
			case WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX:
				if (resolve) return getMagSatFlux();
				return basicGetMagSatFlux();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case WiresPackage.POWER_TRANSFORMER__BMAG_SAT:
				setBmagSat((PerCent)newValue);
				return;
			case WiresPackage.POWER_TRANSFORMER__MAG_BASE_U:
				setMagBaseU((Voltage)newValue);
				return;
			case WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX:
				setMagSatFlux((PerCent)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case WiresPackage.POWER_TRANSFORMER__BMAG_SAT:
				setBmagSat((PerCent)null);
				return;
			case WiresPackage.POWER_TRANSFORMER__MAG_BASE_U:
				setMagBaseU((Voltage)null);
				return;
			case WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX:
				setMagSatFlux((PerCent)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case WiresPackage.POWER_TRANSFORMER__BMAG_SAT:
				return bmagSat != null;
			case WiresPackage.POWER_TRANSFORMER__MAG_BASE_U:
				return magBaseU != null;
			case WiresPackage.POWER_TRANSFORMER__MAG_SAT_FLUX:
				return magSatFlux != null;
		}
		return super.eIsSet(featureID);
	}

} //PowerTransformerImpl
